<%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
	<script LANGUAGE="javascript">
	var checkboxcnt = 0;
	function showSubWin(url) {
		window.open(url)
	}
	function checkboxclick() {
		var all_select = document.getElementById("all_select").value;
    	if(all_select != "" && all_select != null)
    	{
    		return true;
    	}
    	alert("選択対象を1件以上指定して下さい");
		return false;
	}
	function checkSearch() {
	    var check = /^(19|20)[0-9]{2}$/;
		var startDateY = document.getElementById('startDateY');
		var startDateM = document.getElementById('startDateM');
		var startDateD = document.getElementById('startDateD');
		var endDateY = document.getElementById('endDateY');
		var endDateM = document.getElementById('endDateM');
		var endDateD = document.getElementById('endDateD');
		if (startDateY.value != "") {
			if (check.test(startDateY.value) == false) {
				alert("提出日付_FROM年を入力不正");
				document.all("startDateY").focus();
				document.all("startDateY").select();
				return false;
			}
			if (startDateM.value == "") {
				alert("提出日付_FROM月を選択してください");
				document.all("startDateM").focus();
				return false;
			}
			if (startDateD.value == "") {
				alert("提出日付_FROM日を選択してください");
				document.all("startDateD").focus();
				return false;
			}
			if (!realDateCheck(startDateY.value,startDateM.value,startDateD.value,"startDate")) {
				return false;
			}
		} else {
			if (startDateM.value != "" || startDateD.value != "") {
				alert("提出日付_FROM年を入力してください");
				document.all("startDateY").focus();
				document.all("startDateY").select();
				return false;
			}
		}
		if (endDateY.value != "") {
			if (check.test(endDateY.value) == false) {
				alert("提出日付_TO年を入力不正");
				document.all("endDateY").focus();
				document.all("endDateY").select();
				return false;
			}
			if (endDateM.value == "") {
				alert("提出日付_TO月を選択してください");
				document.all("endDateM").focus();
				return false;
			}
			if (endDateD.value == "") {
				alert("提出日付_TO日を選択してください");
				document.all("endDateD").focus();
				return false;
			}
			if (!realDateCheck(endDateY.value,endDateM.value,endDateD.value,"endDateD")) {
				return false;
			}
		} else {
			if (endDateM.value != "" || endDateD.value != "") {
				alert("提出日付_TO年を入力してください");
				document.all("endDateY").focus();
				document.all("endDateY").select();
				return false;
			}
		}
		var l_start = startDateY.value + startDateM.value + startDateD.value;
		var l_end = endDateY.value + endDateM.value + endDateD.value;
		if (l_start != "" && l_end != "" && l_end < l_start) {
			alert("提出日付_TOが、提出日付_FROMより過去日付になっているので修正して下さい。");
			return false;
		}
		return true;
	}
	
	function realDateCheck(y,m,d,strDate) {
			if (m == 1 || m == 3 || m == 5 || m == 7 || m == 8 || m == 10 || m == 12) {
                if(d < 1 || d > 31) {
                    alert("提出日付は實在日付エラー");
                    document.all(strDate+"D").focus();
                    return false;
                }
            } else {
                if(m == 2) {
                    if (y % 400 == 0 || (y % 4 == 0 && y % 100 != 0)) {
                        if(d < 1 || d > 29) {
                            alert("提出日付は實在日付エラー");
                            document.all(strDate+"D").focus();
                            return false;
                        }
                    } else {
                        if(d < 1 || d > 28) {
                            alert("提出日付は實在日付エラー");
                            document.all(strDate+"D").focus();
                            return false;
                        }
                    }
                } else {
                    if(d < 1 || d > 30) {
                        alert("提出日付は實在日付エラー");
                        document.all(strDate+"D").focus();
                        return false;
                    }
                }
            }
            return true;
	}

	function quickSearchbtn(type){
		document.getElementById("quickSearchbutton").value = type;
		return true;
	}
	
	function pageChange(clickpage){
		document.getElementById("pageNow").value = clickpage;
	    document.listform.action = "qaPagecut.action";
		document.listform.submit();
	}
	function viewCheckBox()
	{
	    var checkboxes = document.getElementsByName("banGos");
	    var all_select_obj = document.getElementById("all_select");
	    var all_select = all_select_obj.value;
	
	    for(i = 0; i < checkboxes.length; i ++ )
	    {
	        var checkbox = checkboxes[i];
	        if(checkbox.checked)
	        {
	            if(all_select.indexOf("[" + checkbox.value + "]") == - 1)
	            {
	                all_select += ",[" + checkbox.value + "]";
	            }
	        }
	        else
	        {
	            if(all_select.indexOf(",[" + checkbox.value + "]") != - 1)
	            {
	                all_select = all_select.replace(",[" + checkbox.value + "]", "");
	            }
	            else if(all_select.indexOf("[" + checkbox.value + "]") != - 1)
	            {
	                all_select = all_select.replace("[" + checkbox.value + "]", "");
	            }
	        }
	    }
	    if(all_select.substring(0, 1) == "," && all_select.length > 1)
	    {
	        all_select = all_select.substring(1, all_select.length);
	    }
	    all_select_obj.value = all_select;
	}
	function initCheckBox()
	{
	    var all_select = document.getElementById("all_select").value;
	    if(all_select != "" && all_select != null)
	    {
	        while(all_select.indexOf("[") != - 1 || all_select.indexOf("]") != - 1)
	        {
	            var all_select = all_select.replace("[", "").replace("]", "");
	        }
	        var arrall_select = all_select.split(",");
	        var checkBoxs = document.getElementsByName("banGos");
	        if(arrall_select.length > 0)
	        {
	            for(k = 0; k < arrall_select.length; k ++ )
	            {
	                for(i = 0; i < checkBoxs.length; i ++ )
	                {
	                    if(checkBoxs[i].value == arrall_select[k])
	                    {
	                        checkBoxs[i].checked = true;
	                    }
	                }
	            }
	        }
	    }
	}
    function checkAllBox()
	{
		var checkAll = document.getElementById("checkAll");
		var checkboxes = document.getElementsByName("banGos");
		if(checkAll.checked){
			for(i = 0; i < checkboxes.length; i ++ )
    		{
    			checkboxes[i].checked = true;
    		}
		}
		else
		{
			for(i = 0; i < checkboxes.length; i ++ )
    		{
    			checkboxes[i].checked = false;
    		}
		}
		viewCheckBox();
	}
	function resetForm(){
		document.getElementsByName("search.projectId")[0].value = "";
		document.getElementsByName("search.tema")[0].value = "";
		document.getElementsByName("search.askStartDate_Y")[0].value = "";
		document.getElementsByName("search.askStartDate_M")[0].value = "";
		document.getElementsByName("search.askStartDate_D")[0].value = "";
		document.getElementsByName("search.askEndDate_Y")[0].value = "";
		document.getElementsByName("search.askEndDate_M")[0].value = "";
		document.getElementsByName("search.askEndDate_D")[0].value = "";
		document.getElementsByName("search.asker")[0].value = "";
		document.getElementsByName("search.asked")[0].value = "";
		document.getElementsByName("search.sts")[0].value = "";
		return false;
	}
	</script>
	<style type="text/css">
	    body {
            font-family: Arial, Helvetica, sans-serif;
            font-size:12px;
            }
		div#viewEditArea div.guideMsg{
			padding-left:2ex;
			color:#993300;
			font-size:12px;
		}
	 fieldset {
           padding:10px;
           margin-top:5px;
           border:1px solid #A4CDF2;
           font-size:12px;
        }
	  .test{
			width:40px;
			color:#003366;
			font-size:12px;
		}
      fieldset legend {
          font-weight:bold;
          font-size:15px;
          color:#3568cc;
        }
	  col.item1{
			width:30%;
		}
	   col.value{
			width:70%;
		}

		col.col1{
			width:3%;
		}
		col.col2{
			width:4%;
		}
		col.col3{
			width:6%;
		}
		col.col4{
			width:5%;
		}
		col.col5{
			width:8%;
		}
		col.col6{
			width:17%;
		}
		col.col7{
			width:5%;
		}
		col.col8{
			width:4%;
		}
		col.col9{
			width:5%;
		}
		col.col10{
			width:4%;
		}
		col.col11{
			width:4%;
		}
		col.col12{
			width:4%;
		}
		
		div#contentArea table.pol_list{
			border-style:none;
			border-collapse:collapse;
			width:100%;
			font-size:12px;
		}
		table.pol_list th{
			border-style:solid;
			border-width:0ex;
			border-collapse:collapse;
			border-color:#A4CDF2;
			border-spacing:0px;
			background-color:#87cefa;
			vertical-align:middle;
			text-align:center;
			padding:0.5ex 0.3ex;
			font-size:12px;
		}
		table.pol_list td{
			border-style:solid;
			border-width:0.1ex;
			border-collapse:collapse;
			border-color:#A4CDF2;
			border-spacing:0px;
			background-color:#eeeeee;
			vertical-align:middle;
			text-align:center;
			padding:0.5ex 0.5ex;
			font-size:12px;
		}
		table.pol_list td.kingaku{
			text-align:right;
			font-size:12px;
		}
		table.pol_list td.kingaku2{
			text-align:right;
			vertical-align:top;
			font-size:12px;
		}
		table.pol_list td.sentaku{
			text-align:left;
			font-size:12px;
		}
		table.pol_list td.name{
			text-align:left;
			font-size:12px;
		}
		table.pol_list td.name2{
			text-align:left;
			vertical-align:top;
			font-size:12px;
		}
		table.pol_list td.check{
			width:4%;
			font-size:12px;
		}
		table.pol_list td.check2{
			vertical-align:top;
			font-size:12px;
		}
		table.pol_list th.left{
			text-align:left;
			font-size:12px;
		}
		table.pol_list td.siborikomi_msg{
			text-align:left;
			color:red;
			padding-left:3ex;
			font-size:12px;
		}
	  .select{
          width:140px;
          border-right: #000000 1px solid;
          border-top: #ffffff 1px solid;
          border-left: #ffffff 1px solid;
          color:#003366;
          border-bottom: #000000 1px solid;
          background-color: #f4f4f4;
          font-size:12px;
      }
      .select_m{
          border-right: #000000 1px solid;
          border-top: #ffffff 1px solid;
          border-left: #ffffff 1px solid;
          color:#003366;
          border-bottom: #000000 1px solid;
          background-color: #f4f4f4;
          font-size:12px;
      }
   .btn_1{   
      BORDER-RIGHT:#002D96 1px solid;   
      PADDING-RIGHT:2px;   
      BORDER-TOP:#002D96 1px solid;   
      PADDING-LEFT:2px;   
      FONT-SIZE:12px;
      FILTER: progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr=#FFFFFF,EndColorStr=#9DBCEA);   
      BORDER-LEFT:#002D96 1px solid;   
      CURSOR: hand;   
      COLOR: black;   
      PADDING-TOP:2px;   
      BORDER-BOTTOM:#002D96 1px solid;
      HEIGHT:20px;
      TEXT-ALIGN:CENTER;   
    }
    .select_hidden{
       display:none;
    }
    .test_textfield{
			width:140px;
			color:#003366;
			font-size:12px;
		}
	</style>
	<title>一覧</title>
</head>

<body text=#003366 onload="initCheckBox();">
<s:form name="listform" method="POST">
<input type="hidden" id="all_select" name="all_select" value="<s:property value="all_select"/>" />
<div id="viewEditArea">
	<table cellpadding="0" cellspacing="0" width="100%" bgcolor=RGB(238,242,251)>
	<tr><td style="font-size:15px;color:#3568cc;"><b>QA一覧</b></td></tr>
	</table>
	
<fieldset>
<legend>QA検索</legend>
	<div id="contentArea">
	<table cellspacing="10" summary="隙間用"><tr><td></td></tr></table>
	<table>
	    <tr>
	        <td style="font-size:12px;">プロジェクト</td>
	        <td>
		        <s:select theme="simple" cssClass="select" id="projectId" name="search.projectId" headerKey="" headerValue="" list="projectList" listKey="projectId" listValue="projectName" value="search.projectId" />
        </td>
	    </tr>
		<tr>
		    <td style="font-size:12px;">テーマ名</td>
			<td>
				<s:select theme="simple" cssClass="select" id="tema" name="search.tema" headerKey="" headerValue="" list="functionArray" listKey="theme_id" listValue="theme_name" value="search.tema" />
			</td>
		</tr>
		<tr>
			<td style="font-size:12px;">提出日付</td>
			<td style="font-size:12px;">
				<s:textfield id="startDateY" name="search.askStartDate_Y" maxlength="4" theme = "simple" cssClass= "test"/>年
				<s:select id="startDateM" name="search.askStartDate_M" headerKey="" headerValue="" list="monthArray" value="search.askStartDate_M" theme = "simple" cssClass="select_m"/>月
				<s:select id="startDateD" name="search.askStartDate_D" headerKey="" headerValue="" list="dayArray" value="search.askStartDate_D" theme = "simple" cssClass="select_m"/>日~
				<s:textfield id="endDateY" name="search.askEndDate_Y" maxlength="4" theme = "simple" cssClass= "test"/>年
				<s:select id="endDateM" name="search.askEndDate_M" headerKey="" headerValue="" list="monthArray" value="search.askEndDate_M" theme = "simple" cssClass="select_m"/>月
				<s:select id="endDateD" name="search.askEndDate_D" headerKey="" headerValue="" list="dayArray" value="search.askEndDate_D" theme = "simple" cssClass="select_m"/>日
			</td>
		</tr>
		<tr>
		    <td style="font-size:12px;">提出者</td>
			<td>
		        <s:select theme="simple" name="search.asker" headerKey="" headerValue="" list="askerArray" listKey="user_disp_value" listValue="user_disp_value" value="search.asker" cssClass="select"/>
			</td>
		</tr>
		<tr>
		   <td style="font-size:12px;">問合先</td>
			<td>
		        <s:select  id="asked" theme="simple"  name="search.asked" headerKey="" headerValue="" list="askedArray" listKey="user_disp_value" listValue="user_disp_value" value="search.asked" cssClass="select"/>
			</td>
		</tr>
		<tr>
		   <td style="font-size:12px;">状態</td>
			<td>
		        <s:select theme="simple" name="search.sts" headerKey="" headerValue="" list="stsArray" listKey="master_value" listValue="master_value" value="search.sts" cssClass="select"/>
			</td>
		</tr>
       <tr>
           <td style="font-size:12px;">キー</td>
			<td>
		        <s:textfield  name="search.key"  theme = "simple" cssClass="test_textfield" />
			</td>
       </tr>        
	</table>
	<table width="100%">
	<tr>
	<td width="10"><img src="Img/btn_search_box.gif" width="27" height="20" alt="Search" align="right"/></td>
	<td width="20"><s:submit btnId="C001" action = "qaList" value = "検   索" theme = "simple" onclick="return checkSearch();" cssClass="btn_1" /></td>
	<td width="20"><s:submit btnId="C002" action = "qaAllList" value = "全   件" theme = "simple" cssClass="btn_1" /></td>
	<td width="20"><s:submit btnId="C003" theme = "simple" name="reset" value="リッセト" onclick="return resetForm();" cssClass="btn_1" /></td>
    <td></td><td></td><td></td>    
    <td width="20"><img src ="Img/4.bmp" align="right"></td><td width="50"><s:submit btnId="C004" action = "qaNew" value = "新         規" theme = "simple" cssClass="btn_1" /></td> 
	</tr>
	</table>
	</div>
</fieldset>
<fieldset>
  <legend>業務検索</legend>
		<table cellpadding="0" cellspacing="0" width="100%" bgcolor=RGB(238,242,251)>
		  <tr bgcolor=RGB(238,242,251)>			   
		  <td><img src ="Img/2.bmp" align="right"></td><td><s:submit btnId="C005" action = "qaQuickSearch" value = "   業 務SU  " theme = "simple" onclick="return quickSearchbtn('btn_1');" cssClass="btn_1"/></td>
		  <td><img src ="Img/2.bmp" align="right"></td><td><s:submit btnId="C006" action = "qaQuickSearch" value = "内部管理SU " theme = "simple"  onclick="return quickSearchbtn('btn_2');" cssClass="btn_1"/></td>
		  <td><img src ="Img/2.bmp" align="right"></td><td><s:submit btnId="C007" action = "qaQuickSearch" value = " 保険金SP " theme = "simple"  onclick="return quickSearchbtn('btn_3');" cssClass="btn_1"/></td>
		  <td><img src ="Img/2.bmp" align="right"></td><td><s:submit btnId="C008" action = "qaQuickSearch" value = "ＶＢ現行廃止" theme = "simple" onclick="return quickSearchbtn('btn_4');" cssClass="btn_1"/></td>
		  </tr>
		</table>
</fieldset>
		<table cellspacing="10" summary="隙間用"><tr><td></td></tr></table>
<s:if test="null != qalists">
    <fieldset>
	<legend>QA一覧</legend>
	<table class="pol_list">
	        <col class="col1">
			<col class="col1">
			<col class="col5">
			<col class="col3">
			<col class="col2">
			<col class="col4">
			<col class="col6">
			<col class="col7">
			<col class="col8">
			<col class="col9">
			<col class="col10">
			<col class="col11">
			<col class="col12">
			<tr>		    
			    <th><input type="checkbox" id="checkAll" name="checkAll" value="チエック" onclick="checkAllBox();" /></th>
				<th>項番</th>
				<th>プロジェクト</th>
				<th>テーマ名</th>
				<th>段階</th>
				<th>発生箇所</th>
				<th>質問概要</th>
				<th>提出日付</th>
				<th>提出者</th>
				<th>回答期限</th>
				<th>状態</th>
				<th>緊急度</th>
				<th>問合先</th>
			</tr>
			<s:iterator value="qalists">
			<tr id="qalist<s:property value="banGo"/>">
				<td>
					<input type="checkbox" id="banGos" name="banGos"  value='<s:property value="banGo"/>' onclick="viewCheckBox();" />
				</td>
				
				<td><s:property value="banGo"/></td>
				<td><s:property value="project"/></td>
				<td><s:property value="tema"/></td>
				<td><s:property value="dankai"/></td>
				<td><s:property value="kasho"/></td>
				<td><a href="JavaScript:void(0)" onClick="showSubWin('qaDetail.action?bango=<s:property value="banGo"/>')"><s:property value="gaIYo"/></a></td>
				<td><s:property value="inputDate"/></td>
				<td><s:property value="asker"/></td>
				<td><s:property value="limmitDate"/></td>
				<td><s:property value="status"/></td>
				<td><s:property value="emergencyDegree"/></td>
				<td><s:property value="toIAWaSeSaKi"/></td>
			</tr>
			</s:iterator>
	</table>
	<div align="center">
	 <span>
     <s:if test="pagePre == 0">
     	<a>前のページ</a>
     </s:if>
     <s:else>
   	 	<a  href="JavaScript:pageChange('<s:property value="pagePre"/>');">前のページ</a>
   	 </s:else>
   	 <s:if test="totalPages < pageNext">
     	<a>后のページ</a>
     </s:if>
     <s:else>
   	 	<a  href="JavaScript:pageChange('<s:property value="pageNext"/>');">后のページ</a>
   	 </s:else>
     </span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
	<b><span align="right">
		<s:if test="pageNow > totalPages">
			0/0
		</s:if>
		<s:else>
			<s:property value="pageNow"/>/<s:property value="totalPages"/>
		</s:else>
	</span></b>
	</div>
     <input type="hidden" id="pageNow" name="pageNow" value="">
    <table cellspacing="10" summary="隙間用"><tr><td></td></tr></table>
		<table cellpadding="0" cellspacing="0" width="100%" bgcolor=RGB(238,242,251)>
		  <tr bgcolor=RGB(238,242,251)>		   
		  <td><img src ="Img/1.bmp" align="right" alt="delete"></td><td align="left"><s:submit btnId="C009" action = "qaDelete" value = "削         除" theme = "simple" onclick="return checkboxclick();" cssClass="btn_1"/></td>
		  <td><img src ="Img/2.bmp" align="right" alt="export"></td><td align="left"><s:submit btnId="C010" action = "qaExport" value = "エクスポート" theme = "simple" onclick="return checkboxclick();"  cssClass="btn_1"/></td>
		  <td><img src ="Img/3.bmp" align="right" alt="mail"></td><td align="left"><s:submit btnId="C011" action = "qaEmail" value = "メール送付" theme = "simple" onclick="return checkboxclick();"  cssClass="btn_1"/></td>
		  </tr>
		</table>
	</fieldset>
</s:if>
</div>
<input type="hidden" id="quickSearchbutton" name="quickSearchbuttonID" value="">
</s:form>

</body>
</html>